import {Routes, Route } from 'react-router-dom'

import GeekLayout from './pages/Layout'
import Login from './pages/Login'
import { AuthRoute } from '@/components/authRoute.js'
import Home from '@/pages/Home'
import Articles from '@/pages/Articles'
import Publish from '@/pages/Publish'
import { history, HistoryRouter } from '@/utils/history.js'

function App() {
  return (
    <HistoryRouter history={ history }>
      <div className="App">
        <Routes>
          <Route path='/' element={ 
            <AuthRoute> <GeekLayout/> </AuthRoute>
           }>
            {/* 二级路由 */}
            <Route index element={ <Home/> }></Route>
            <Route path='/articles' element={ <Articles/> }></Route>
            <Route path='/publish' element={ <Publish/> }></Route>

           </Route>
          
          <Route path='/login' element={<Login />}></Route>
        </Routes>
      </div>
    </HistoryRouter>
  );
}

export default App;
